#Assuming you working on conda:
conda install -c conda-forge mscorefonts
#Then detete the cache as follows:
rm ~/.cache/matplotlib -rf
#Use the following as fit:
import matplotlib
myfonts = "Times New Roman"
matplotlib.rcParams['font.family'] = "sans-serif"
matplotlib.rcParams['font.sans-serif'] = myfonts